package bsh.meta;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

/**
 * {@link FieldDescriptor} para um {@link Field}
 * 
 * @author takeshi
 */
public class JavaFieldDescriptor extends AbstractFieldDescriptor implements FieldDescriptor {

    private final Field field;

    /**
     * @param field {@link Field}
     */
    public JavaFieldDescriptor(Field field) {
        super(JavaClassWrapper.wrapperFor(field.getDeclaringClass()), JavaClassWrapper.wrapperFor(field.getType()));
        this.field = field;
    }

    /**
     * {@inheritDoc}
     */
    public String fieldName() {
        return this.field.getName();
    }

    /**
     * {@inheritDoc}
     */
    public int asmModifiers() {
        return this.field.getModifiers();
    }

    /**
     * {@inheritDoc}
     */
    public boolean isStatic() {
        return Modifier.isStatic(this.field.getModifiers());
    }

}
